package classesdemo;
//显示Math中数学值的求法
//移位操作，无符号右移
//无符号右移的意义在于可以使java操作更大范围的数，连符号位也可以当做数值，有了32位，64位无符号数

class MathTest
{
	public static void main(String args[])
	{

        System.out.println(1<<3);
		System.out.println("4 >> 2: " + (4 >> 2));
		System.out.println("4 >>> 2: " + (4 >> 2));
		System.out.println("-4 >> 2: " + (-4 >> 2));
		System.out.println("-4 >>> 2: " + (-4 >>> 2));
        System.out.println(-178 >> 4);
        System.out.println(-178 >>> 4);

		double x=180.0000;
		float y = -23.499f;
		System.out.println("x的值为:"+x);
		System.out.println("0.5的abs值为:"+Math.abs(0.5));
		System.out.println("-11.5的abs值为:"+Math.abs(-11.5));
		System.out.println("-23.499 的ceil:"+Math.ceil(y));
		System.out.println("-23.499 的floor:"+Math.floor(y));
		//round的返回值为最接近的整形
		System.out.println("-23.499 的round:"+Math.round(y));
		System.out.println("x的平方根为:"+Math.sqrt(x));
		System.out.println("x的平方为:"+Math.pow(x,4.0));  //平方
		System.out.println("x的Floor值为:"+Math.floor(x));
		System.out.println("x的Ceiling值为:"+Math.ceil(x));
		System.out.println("x的Rint值为:"+Math.rint(x));  //最接近的值
		System.out.println("x的Round值为:"+Math.round(x));  //最接近的值
		System.out.println("x的toDegree值为:"+Math.toDegrees(x)+"度");  //最接近的值
		System.out.println("x的toRadius值为:"+Math.toRadians(x)+"弧度");  //最接近的值
		
		
	}
}

